Skip to content

fix: add encoding="utf-8" to state_store.py read_text/write_text calls - #114

Open
olong75 wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
olong75:fix/state-store-encoding
Open

fix: add encoding="utf-8" to state_store.py read_text/write_text calls#114
olong75 wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
olong75:fix/state-store-encoding

Conversation

@olong75

@olong75 olong75 commented Aug 30, 2026

Copy link
Copy Markdown

FarosStateStore persists run records, events, artifacts and memory with Path.read_text() / Path.write_text() — six call sites, none of which pass encoding="utf-8". Both methods fall back to locale.getpreferredencoding(), which is not UTF-8 on Windows cp1252 systems or minimal containers running the C/POSIX locale.

FAROS run data routinely contains non-ASCII content (Chinese paper topics, Unicode agent outputs), so on those hosts create_run / save_memory raise UnicodeEncodeError, and reading a run back raises UnicodeDecodeError.

Changes:

  • encoding="utf-8" on all five read_text() call sites (list_runs, get_run, list_events, list_artifacts, get_memory)
  • encoding="utf-8" on the single write_text() call in _save_json

Verified with backend/tests/test_pr_b21_state_store_encoding.py: round-trips a run with a Chinese topic through create_runget_run / list_runs, and non-ASCII memory / events / artifacts through their save + list paths. All 3 tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant